package com.itheima.web.controller;

import com.itheima.entity.CodeConstant;
import com.itheima.entity.Result;
import com.itheima.entity.StudentMessageConstant;
import com.itheima.pojo.Student;
import com.itheima.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Name StudentController
 * @Author BaiXin
 * @Date 2022-10-21 19:26
 */
@RestController
@RequestMapping("/student")
public class StudentController {

    @Autowired
    private StudentService studentService;

    @GetMapping
    public Result findAll(){
       List<Student> students =  studentService.findAll();
       return Result.success(CodeConstant.GET_OK, StudentMessageConstant.Student_QUERY_OK,students);
    }
}
